﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pseudogenerator.Common.Generators.Core;

namespace Pseudogenerator.Common.Generators
{
    public abstract class Congruential
        : MethodBase
    {
        /// <summary>
        /// Multiplicador
        /// </summary>
        public uint a { get; set; }



        override public List<RandomNumber> GetFullList()
        {
            bool Started = false;
            var _results = new List<RandomNumber>();

            int i = 1;
            this.ResetActualValue();
            while ((this.Next() != this.x0 || i == 0 || !Started) && _results.Where(r => r.Xn == this.ActualValue).Count() == 0)
            {
                Started = true;
                _results.Add(new RandomNumber(this.m) { n = this.ActualIndex, Xn = this.ActualValue });

                i++;
                if (i == (Math.Pow(2, 32))) break;
            }
            _results.Add(new RandomNumber(this.m) { n = this.ActualIndex, Xn = this.ActualValue });

            return _results;
        }
    }
}
